from functools import wraps
from copy import deepcopy


def immutable_args(func):
    """将参数进行深拷贝，并将拷贝结果作为替换原参数传入`func`中"""

    @wraps(func)
    def wrapper(*args, **kwargs):
        return func(*deepcopy(args), **deepcopy(kwargs))

    return wrapper
